feat(cast): add --sponsor-url for remote Tempo fee payer sponsorship#14790
Merged
Conversation
Adds --sponsor-url (alias --tempo.sponsor-url) to cast send. When set, the transaction is signed locally and forwarded to the remote sponsor service via eth_sendRawTransaction. The service adds its fee payer signature and broadcasts the sponsored transaction. Usage: cast send 0x... --sponsor-url https://sponsor.tempo.xyz/tp_abc123 This works with the existing fee-payer service in tempo-apps without any changes — no new RPC methods required. The sponsor URL can also be set via TEMPO_SPONSOR_URL env var. Amp-Thread-ID: https://ampcode.com/threads/T-019e2d8c-7750-71a5-924c-2394c0c4e070
…nsor_url - Use eth_signRawTransaction to get the sponsored tx from the service, then submit via the regular RPC's send_raw_transaction. This matches the viem withFeePayer sign-only protocol. - Clone sponsor_url instead of take() so it's still present when TempoOpts::apply() runs, ensuring nonce_key=0 is set and the tx builds as a Tempo AA (0x76) type instead of EIP-1559 (0x02). - Handle sponsor service error responses that have name/code but no message field. Amp-Thread-ID: https://ampcode.com/threads/T-019e2d8c-7750-71a5-924c-2394c0c4e070
- Sign sponsored Tempo payload by setting a placeholder fee_payer_signature before local signing, so the sender commits to the sponsored variant - Bail out when --sponsor-url is combined with --unlocked, --browser, or a Tempo access key instead of silently ignoring it - Validate sponsor URL scheme (require https://, allow http only for localhost/127.0.0.1) - Tighten JSON-RPC response parsing: accept arbitrary result types, drop non-standard 'name' error field Co-authored-by: Amp <amp@ampcode.com>
mattsse
requested changes
May 25, 2026
mattsse
left a comment
Member
There was a problem hiding this comment.
i think this pr has scope creep
The previous commit bundled unrelated anvil backend refactoring (amsterdam_eip8037_enabled plumbing) into a CI fix commit.
The tempo-alloy dependency tree pulls in criterion, which depends on a crates.io package also named cast (v0.3.0). Using -p cast is now ambiguous; --bin cast unambiguously targets the Foundry binary.
The old check accepted bypass hostnames like localhost.evil.com and 127.0.0.1.evil.com; the new check inspects scheme() and host_str() precisely.
mablr
reviewed
May 25, 2026
mattsse
approved these changes
May 25, 2026
mattsse
left a comment
Member
There was a problem hiding this comment.
Approving based on follow-up: the noted tradeoffs are acceptable for this PR.
figtracer
approved these changes
May 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
--sponsor-url(alias--tempo.sponsor-url) tocast send. When set, Foundry signs locally and routes the raw transaction throughtempo-alloy's sponsor relay transport so the sponsor service can add its fee-payer signature.Usage
Or via env var:
How it works
FEE_PAYER_SIGNATURE_MARKERso the sender signs the sponsored payloadRelayConnectorwithSponsorshipMode::SignOnlyto call the sponsor serviceChanges
Cargo.toml/Cargo.lock: Bumped Tempo crates to thetempo-alloy@1.7.3release rev.crates/cast/src/cmd/send.rs: Replaced manual sponsor JSON-RPC/reqwestflow withtempo-alloyrelay transport types.crates/cast/Cargo.toml: Removed directreqwestusage and added directalloy-rpc-clientusage for built-in connection strings.Prompted by: @0xrusowsky